import request from '@/libs/request'

const roleBaseApi = '/admin/role/'

export const getList = (params) => {
  return request({
    url: roleBaseApi + 'dataGrid',
    params
  })
}

export const add = (params) => {
  return request({
    url: roleBaseApi + 'add',
    method: 'put',
    params
  })
}

export const edit = (params) => {
  return request({
    url: roleBaseApi + 'edit',
    method: 'post',
    params
  })
}

export const del = (params) => {
  return request({
    url: roleBaseApi + 'delete',
    method: 'delete',
    params
  })
}

export const findResourceIdListByRoleId = (params) => {
  return request({
    url: roleBaseApi + 'findResourceIdListByRoleId',
    method: 'get',
    params
  })
}

export const grant = (data) => {
  return request({
    url: roleBaseApi + 'grant',
    method: 'post',
    data
  })
}

export const roleTree = () => {
  return request({
    url: roleBaseApi + 'tree',
    method: 'get'
  })
}
